<template>
  <div>
    <div
      class="card"
      v-for="item in list"
      :key="item.id"
      @click="router.push('/repair/detail?id=' + item.id)"
    >
      <div class="card_title">
        {{ item.buildingLocationName }}/{{ item.roomLocationName }}
      </div>
      <div class="card_content">
        <svg-icon icon-class="tag" />
        <span>{{ item.repairTypeName }}</span>
      </div>
      <div class="card_content">
        <svg-icon icon-class="time" />
        <span>{{ dayjs(item.createTime).format("YYYY-MM-DD hh:mm") }}</span>
      </div>
      <div class="card_content">
        <svg-icon icon-class="remember" />
        <span>{{ item.personName }}</span>
        <div class="content_phone" @click.stop="telPhone(item.personMobile)">
          <span>{{ item.personMobile }}</span>
          <svg-icon icon-class="phone" />
        </div>
      </div>
      <div class="card_word">{{ item.repairDesc }}</div>
    </div>
    <!-- <DialogPhone ref="phoneRef" /> -->
  </div>
</template>

<script setup lang="ts">
// import DialogPhone from "@/components/DialogPhone/index.vue";
import router from "@/router";
// import { ref } from "vue";
import * as dayjs from "dayjs";
defineProps({
  list: Array,
});
// const phoneRef = ref();
// 打电话
const telPhone = (phone) => {
  window.location.href = `tel:${phone}`;
};
</script>

<style lang="less" scoped>
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: 10px;
  background-color: #ffffff;
  margin-bottom: 16px;
  .card_title {
    font-size: 16px;
    font-weight: 600;
    color: #303233;
    line-height: 24px;
    margin-bottom: 14px;
  }
  .card_content {
    margin-bottom: 12px;
    font-size: 14px;
    color: #616366;
    line-height: 22px;
    position: relative;
    svg {
      margin-right: 11px;
    }
    .content_phone {
      position: absolute;
      top: 0;
      right: 0;
      span {
        font-size: 14px;
        font-family: PingFang SC, PingFang SC-Regular;
        font-weight: 400;
        text-align: RIGHT;
        color: #3e77fa;
        line-height: 22px;
      }
      svg {
        margin-left: 11px;
        color: #3e77fa;
      }
    }
  }
  .card_word {
    font-size: 14px;
    color: #616366;
    line-height: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }
}
</style>
